From: Ray Tung Date: Tue, 3 Oct 2017 14:05:57 +0000 (+1100) Subject: Updated test to ensure cargo update transforms Cargo.lock X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~6^2~20^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=f5fbf730154c2be401b77ec4cdb9055f5acd24ba;p=cargo.git Updated test to ensure cargo update transforms Cargo.lock --- diff --git a/tests/lockfile-compat.rs b/tests/lockfile-compat.rs index 39a7426a5..ffb3900da 100644 --- a/tests/lockfile-compat.rs +++ b/tests/lockfile-compat.rs @@ -10,7 +10,7 @@ use hamcrest::assert_that; fn oldest_lockfile_still_works() { Package::new("foo", "0.1.0").publish(); - let expected_lock_file = + let expected_lockfile = r#"[[package]] name = "bar" version = "0.0.1" @@ -27,7 +27,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum foo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "[..]" "#; - let lockfile = r#" + let old_lockfile = r#" [root] name = "bar" version = "0.0.1" @@ -52,18 +52,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" foo = "0.1.0" "#) .file("src/lib.rs", "") - .file("Cargo.lock", lockfile); + .file("Cargo.lock", old_lockfile); p.build(); - assert_that(p.cargo("build"), - execs().with_status(0)); + let cargo_commands = vec![ + "build", + "update" + ]; - let lock = p.read_lockfile(); - for (l, r) in expected_lock_file.lines().zip(lock.lines()) { - assert!(lines_match(l, r), "Lines differ:\n{}\n\n{}", l, r); - } + for cargo_command in cargo_commands { + assert_that(p.cargo(cargo_command), + execs().with_status(0)); - assert_eq!(lock.lines().count(), expected_lock_file.lines().count()); + let lock = p.read_lockfile(); + for (l, r) in expected_lockfile.lines().zip(lock.lines()) { + assert!(lines_match(l, r), "Lines differ:\n{}\n\n{}", l, r); + } + + assert_eq!(lock.lines().count(), expected_lockfile.lines().count()); + } } #[test]